
using UnityEngine;

// public enum StateEnum
// {
//     Idle,
//     Patrol,
//     Chase,
//     Attack,
// }

namespace FSM
{
    public abstract class StateMachine : MonoBehaviour
    {
        // private StateEnum curStateEnum;
        private State curState;

        private void Update()
        {
            curState?.Tick(Time.deltaTime);
        }

        public void SwitchState(State newState)
        {
            // if (curState != newState)
            {
                curState?.Exit();

                curState = newState;
                newState?.Enter();
            }
        }
    }

}